package com.sxx.beautifulcity.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.sxx.beautifulcity.R;
import com.sxx.beautifulcity.application.ProjectApplication;
import com.sxx.beautifulcity.toast.commcommonToast;
import com.sxx.beautifulcity.utils.NetWorkUtils;

/**
 * Created by dllo on 15/11/4.
 */
public class JudgeSoftActivity extends AppCompatActivity implements View.OnClickListener {
    private TextView titleTv;
    private Button submit;
    private ImageView backIv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_judge_soft);

        initView();
    }

    private void initView() {
        titleTv = (TextView) findViewById(R.id.titleTv);
        titleTv.setText("评价");
        backIv = (ImageView) findViewById(R.id.backIV);
        backIv.setOnClickListener(this);
        submit = (Button) findViewById(R.id.submit);
        submit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                boolean network = NetWorkUtils.checkNet(JudgeSoftActivity.this);
                if (network == true) {
                    Intent intent = new Intent(ProjectApplication.getContext(), MainActivity.class);
                    startActivity(intent);
                    finish();
                    overridePendingTransition(R.anim.left_out, R.anim.right_into);
                    commcommonToast.submitToast();
               } else {
                    commcommonToast.failToast();
                }
            }
        });
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.backIV:
                Intent backIntent = new Intent();
                backIntent.setClass(this , MainActivity.class);
                startActivity(backIntent);
                finish();
                overridePendingTransition(R.anim.left_out, R.anim.right_into);
                break;
        }
    }
}
